package de.Niklas.Laser.util.ConfigUtil;

import java.util.Arrays;

import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

public class Bundle {
    public static IntConfigSetting OPTIONS_LENGTH;
    public static IntConfigSetting OPTIONS_COOLDOWN;
    public static BooleanConfigSetting OPTIONS_DAMAGEENABLED;
    public static BooleanConfigSetting OPTIONS_DAMAGEPLAYERS;
    public static DoubleConfigSetting OPTIONS_DAMAGE;
    public static BooleanConfigSetting OPTIONS_DESTROYBLOCKS;
    public static CustomConfigSetting OPTIONS_MATERIALS;
    public static BooleanConfigSetting OPTIONS_STOPWHENHITTINGBLOCK;
    public static BooleanConfigSetting OPTIONS_REFLECTWHENHITTINGGLASS;
    public static BooleanConfigSetting OPTIONS_EXPLOSIONWHENHITTINGBLOCK;
    public static BooleanConfigSetting OPTIONS_AMMONEEDED;
    public static BooleanConfigSetting OPTIONS_CRAFTABLEAMMO;
    public static BooleanConfigSetting OPTIONS_CRAFTABLELASER;
    public static BooleanConfigSetting OPTIONS_KNOCKBACK;
    public static BooleanConfigSetting OPTIONS_AIMING;
    public static BooleanConfigSetting OPTIONS_INVERTSHOOTING;
    public static CustomConfigSetting OPTIONS_NAME;
    public static CustomConfigSetting OPTIONS_LORE;
    public static IntConfigSetting OPTIONS_ID;
    public static IntConfigSetting OPTIONS_SUBID;
    public static IntConfigSetting OPTIONS_COLOR_RED;
    public static IntConfigSetting OPTIONS_COLOR_GREEN;
    public static IntConfigSetting OPTIONS_COLOR_BLUE;
    public static CustomConfigSetting OPTIONS_SOUND_NAME;
    public static DoubleConfigSetting OPTIONS_SOUND_VOLUME;
    public static DoubleConfigSetting OPTIONS_SOUND_PITCH;

    static {
        Bundle.OPTIONS_LENGTH = new IntConfigSetting(0, IS(Material.PAPER, 0, ChatColor.YELLOW + "Length:", ChatColor.DARK_GRAY + "The length of the laser beam"));
        Bundle.OPTIONS_COOLDOWN = new IntConfigSetting(0, IS(Material.WATCH, 0, ChatColor.YELLOW + "Cooldown:", ChatColor.DARK_GRAY + "The time in ticks your laser needs to cool"));
        Bundle.OPTIONS_DAMAGEENABLED = new BooleanConfigSetting(false, IS(Material.WOOD_SWORD, 0, ChatColor.YELLOW + "Damage enabled:", ChatColor.DARK_GRAY + "Should the laser damage mobs?"));
        Bundle.OPTIONS_DAMAGEPLAYERS = new BooleanConfigSetting(false, IS(Material.DIAMOND_SWORD, 0, ChatColor.YELLOW + "Damage players:", ChatColor.DARK_GRAY + "Should the laser damage players?"));
        Bundle.OPTIONS_DAMAGE = new DoubleConfigSetting(5.0, IS(Material.POTION, 8268, ChatColor.YELLOW + "Damage:", ChatColor.DARK_GRAY + "The amount of damage"));
        Bundle.OPTIONS_DESTROYBLOCKS = new BooleanConfigSetting(false, IS(Material.GOLD_PICKAXE, 0, ChatColor.YELLOW + "Destroy blocks:", ChatColor.DARK_GRAY + "Should the laser be used as a mining tool?"));
        Bundle.OPTIONS_MATERIALS = new CustomConfigSetting(null, IS(Material.CHEST, 0, ChatColor.YELLOW + "Materials:", ChatColor.DARK_GRAY + "Breakable materials"));
        Bundle.OPTIONS_STOPWHENHITTINGBLOCK = new BooleanConfigSetting(false, IS(Material.IRON_FENCE, 0, ChatColor.YELLOW + "Stop when hitting block:", ChatColor.DARK_GRAY + "Should the beam stop when hitting a block?"));
        Bundle.OPTIONS_REFLECTWHENHITTINGGLASS = new BooleanConfigSetting(false, IS(Material.GLASS, 0, ChatColor.YELLOW + "Reflection when hitting a glass block:", ChatColor.DARK_GRAY + "Should the beam reflect when hitting a glass block?"));
        Bundle.OPTIONS_EXPLOSIONWHENHITTINGBLOCK = new BooleanConfigSetting(false, IS(Material.TNT, 0, ChatColor.YELLOW + "Explosion:", ChatColor.DARK_GRAY + "Should the laser beam create an explosion when hitting a block?"));
        Bundle.OPTIONS_AMMONEEDED = new BooleanConfigSetting(false, IS(Material.REDSTONE, 0, ChatColor.YELLOW + "Ammo needed:", ChatColor.DARK_GRAY + "Should the laser consume ammunition?"));
        Bundle.OPTIONS_CRAFTABLEAMMO = new BooleanConfigSetting(false, IS(Material.WORKBENCH, 0, ChatColor.YELLOW + "Craftable ammo:", ChatColor.DARK_GRAY + "Should ammunition be craftable?"));
        Bundle.OPTIONS_CRAFTABLELASER = new BooleanConfigSetting(false, IS(Material.WORKBENCH, 0, ChatColor.YELLOW + "Craftable laser:", ChatColor.DARK_GRAY + "Should the laser be craftable?"));
        Bundle.OPTIONS_KNOCKBACK = new BooleanConfigSetting(false, IS(Material.ENCHANTED_BOOK, 0, ChatColor.YELLOW + "Knockback:", ChatColor.DARK_GRAY + "Knockback effect when shooting?"));
        Bundle.OPTIONS_AIMING = new BooleanConfigSetting(false, IS(Material.GLASS, 0, ChatColor.YELLOW + "Aiming:", ChatColor.DARK_GRAY + "Zoom with clicking"));
        Bundle.OPTIONS_INVERTSHOOTING = new BooleanConfigSetting(false, IS(Material.DIODE, 0, ChatColor.YELLOW + "Invert shooting:", ChatColor.DARK_GRAY + "Shooting with left-clicking or right-clicking?"));
        Bundle.OPTIONS_NAME = new CustomConfigSetting(null, IS(Material.PAPER, 0, ChatColor.YELLOW + "Name:", ChatColor.DARK_GRAY + "The name of the laser"));
        Bundle.OPTIONS_LORE = new CustomConfigSetting(null, IS(Material.PAPER, 0, ChatColor.YELLOW + "Lore:", ChatColor.DARK_GRAY + "The lore of the laser"));
        Bundle.OPTIONS_ID = new IntConfigSetting(356, IS(Material.PAPER, 0, ChatColor.YELLOW + "ID:", ChatColor.DARK_GRAY + "The ID of the laser"));
        Bundle.OPTIONS_SUBID = new IntConfigSetting(0, IS(Material.PAPER, 0, ChatColor.YELLOW + "Sub-ID:", ChatColor.DARK_GRAY + "The sub-ID of the laser"));
        Bundle.OPTIONS_COLOR_RED = new IntConfigSetting(255, IS(Material.STAINED_GLASS_PANE, 1, ChatColor.YELLOW + "Color - red:", ChatColor.DARK_GRAY + "Red color amount"));
        Bundle.OPTIONS_COLOR_GREEN = new IntConfigSetting(0, IS(Material.STAINED_GLASS_PANE, 10, ChatColor.YELLOW + "Color - green:", ChatColor.DARK_GRAY + "Green color amount"));
        Bundle.OPTIONS_COLOR_BLUE = new IntConfigSetting(0, IS(Material.STAINED_GLASS_PANE, 12, ChatColor.YELLOW + "Color - blue:", ChatColor.DARK_GRAY + "Blue color amount"));
        Bundle.OPTIONS_SOUND_NAME = new CustomConfigSetting(null, IS(Material.JUKEBOX, 0, ChatColor.YELLOW + "Sound Name:", ChatColor.DARK_GRAY + "The sound being played when shooting"));
        Bundle.OPTIONS_SOUND_VOLUME = new DoubleConfigSetting(0.0, IS(Material.NOTE_BLOCK, 0, ChatColor.YELLOW + "Sound Volume:", ChatColor.DARK_GRAY + "The volume of the sound (between 0 and 1)"));
        Bundle.OPTIONS_SOUND_PITCH = new DoubleConfigSetting(0.0, IS(Material.NOTE_BLOCK, 0, ChatColor.YELLOW + "Sound Pitch:", ChatColor.DARK_GRAY + "The pitch of the sound (between 0 and 2)"));
    }

    public static ItemStack IS(final Material m, final int damage, final String name, final String... lore) {
        final ItemStack is = new ItemStack(m, 1, (short) damage);
        final ItemMeta im = is.getItemMeta();
        im.setDisplayName(name);
        im.setLore(Arrays.asList(lore));
        is.setItemMeta(im);
        return is;
    }
}
